package com.CNMedical.web.controller.system.applet;


import com.CNMedical.common.annotation.Anonymous;
import com.CNMedical.common.core.controller.BaseController;
import com.CNMedical.common.core.domain.R;
import com.CNMedical.system.domain.entity.AppletNote;
import com.CNMedical.system.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * 笔记Controller
 *
 * @author tang
 * @date 2023-03-29
 */
@Api(tags = "笔记接口")
@Anonymous
@RestController
@RequestMapping("/applet/note")
public class NoteController extends BaseController {

    @Resource
    private IAppletNoteService iAppletNoteService;

    /**
     * 添加笔记
     *
     * @date 2023-03-30
     */
    @ApiOperation("添加笔记")
    @PostMapping("/addKnowledgeNote")
    public R addKnowledgeNote(@RequestBody AppletNote appletNote) {
        return R.ok(iAppletNoteService.insertAppletNote(appletNote));
    }

    /**
     * 删除笔记
     *
     * @date 2023-03-30
     */
    @ApiOperation("删除笔记")
    @PostMapping("/deleteKnowledgeNote/{noteId}")
    public R deleteKnowledgeNote(@PathVariable Long noteId) {
        return R.ok(iAppletNoteService.deleteAppletNoteById(noteId));
    }

    /**
     * 我的笔记
     *
     * @date 2023-03-30
     */
    @ApiOperation("我的笔记")
    @GetMapping("/getMyNote/{userId}")
    public R getMyNote(@PathVariable String userId) {
        return R.ok(iAppletNoteService.getMyNote(userId));
    }

}
